﻿using System;
using System.Collections.Generic;
using System.Text;

namespace StockTrader.FrontEnd.DataContract.Quote
{
    public class HnxStockInfo
    {
        public string Code { set; get; }

        public int Ref { set; get; }
        public int Ceiling { set; get; }
        public int Floor { set; get; }

        public int Open { set; get; }
        public int High { set; get; }
        public int Low { set; get; }
        public int Avg { set; get; }

        public long TotalOffer { set; get; }
        public long TotalBid { set; get; }

        public int MatchPrice { set; get; }
        public long MatchQtty { set; get; }

        public long TotalTradedQtty { set; get; }

        public long FBuy { set; get; }
        public long FSell { set; get; }


        public HnxStockInfo() { }

        public HnxStockInfo(string code, decimal dateno,decimal open, decimal high, decimal low, decimal avg, decimal totaloffer, decimal totalbid, decimal priorcloseprice, decimal matchprice, decimal matchqtty,  decimal fbuy, decimal fsell)
        {
            this.Code = code;
            this.Open = Convert.ToInt32(open);
            this.High = Convert.ToInt32(high);
            this.Low = Convert.ToInt32(low);
            this.Avg = Convert.ToInt32(avg);
            this.TotalOffer = Convert.ToInt64(totaloffer);
            this.TotalBid = Convert.ToInt64(totalbid);
            this.MatchPrice = Convert.ToInt32(matchprice);
            this.MatchQtty = Convert.ToInt64(matchqtty);            
            this.FBuy = Convert.ToInt64(fbuy);
            this.FSell = Convert.ToInt64(fsell);
        }

        #region IComparable Members

        public override bool Equals(object obj)
        {
            if (Code.Equals(((HnxStockInfo)obj).Code))
                return TotalTradedQtty.Equals(((HnxStockInfo)obj).TotalTradedQtty);
            else
                return Code.Equals(((HnxStockInfo)obj).Code);
        }
        #endregion

    }
}
